package yunwo.cn.yzstation.presenter;

import yunwo.cn.yzstation.api.IinventoryModel;
import yunwo.cn.yzstation.base.BasePresenter;
import yunwo.cn.yzstation.bean.InventoryBean;
import yunwo.cn.yzstation.api.IinventoryView;
import yunwo.cn.yzstation.model.InventoryModel;
import yunwo.cn.yzstation.view.activity.InventoryActivity;
import yunwo.cn.yzstation.view.fregment.inventory.InventoryFragment;

/**
 * Created by lao on 2017/9/14.
 */

public class InventoryFragmentPersenter extends BasePresenter<IinventoryView> implements IinventoryModel {
    InventoryActivity inventoryActivity;
    InventoryFragment inventoryFragment;
    IinventoryView iinventoryView;
    private final InventoryModel mInventoryModel;

    public InventoryFragmentPersenter(InventoryActivity inventoryActivity, InventoryFragment inventoryFragment,
                                      IinventoryView iinventoryView) {
        attachView(iinventoryView);
        this.inventoryActivity = inventoryActivity;
        this.inventoryFragment = inventoryFragment;
        this.iinventoryView = iinventoryView;
        mInventoryModel = new InventoryModel(inventoryActivity,this);
    }

    public void getData(String type,int pageNum,int pageSize) {
        mInventoryModel.getData(type,pageNum,pageSize);

    }

    @Override
    public void getListDataSuccess(InventoryBean.DataBean dataBean,String type) {
        iinventoryView.getListDataSuccess(dataBean,type);
    }

    @Override
    public void getListDataFailure() {
        iinventoryView.getListDataFailure();
    }
}
